﻿/*
   Open Intel 
   Copyright © 2011 – ISC. All Rights Reserved.
*/
using System;
using System.Windows;
using System.Windows.Data;

namespace OI.Framework
{
    public class BoolToVisibilityConverter : IValueConverter
    {
        #region IValueConverter Members
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is bool && targetType == typeof(Visibility))
            {
                bool val = (bool)value;
                if (parameter is string && string.Compare((string)parameter, "inverse", StringComparison.CurrentCultureIgnoreCase) == 0)
                {
                    val = !val;
                }
                return (val ? Visibility.Visible : Visibility.Collapsed);
            }
            throw new NotImplementedException();
        }
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
        #endregion
    }

}
